package EJBSession;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import model.Employe;

/**
 * Session Bean implementation class BeanEmploye
 */
@Stateless
public class BeanEmploye implements BeanEmployeRemote {
    /**
     * Default constructor. 
     */
	@PersistenceContext
    EntityManager manager;
	
	private Employe employe;
	private String nom;
	private String prenom;
	
    public BeanEmploye() {
        
    }
    
	/*public BeanEmploye(int id) {
        employe = (Employe)manager.createNamedQuery("EmployeParId").setParameter("param_id_employe", id).getSingleResult();
        nom=employe.getEmployeNom();
        prenom=employe.getEmployePrenom();
	}*/
    
	public Employe getEmployeById(int id) {
        return (Employe)manager.createNamedQuery("EmployeParId").setParameter("p_id_employe", id).getSingleResult();
    }

	
    public EntityManager getManager() {
		return manager;
	}
	public void setManager(EntityManager manager) {
		this.manager = manager;
	}
	public Employe getEmploye() {
		return employe;
	}
	public void setEmploye(Employe employe) {
		this.employe = employe;
	}
	public String getNom() {
		return nom;
	}
	public void setNom(String nom) {
		this.nom = nom;
	}
	public String getPrenom() {
		return prenom;
	}
	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

}
